<?php
namespace Home\Service;
use Think\Model;
class YgclOrderService extends Model {
	
	private $m;	
	function __construct(){
		$this->m = D('YgclOrder');
	}
	
	//判断是否为老生
	public function checkOldStudent($uid){
		$map['uid'] = $uid;
		$map['type'] = array(array('eq','baoming'),array('eq','midbm'),'OR');
		$map['status'] = 1;
		$oldorder = $this->m->where($map)->order('id desc')->find();
		if($oldorder){
			return $oldorder;
		}else{
			return false;
		}
	}
   

	/**
	 * 判断打赏订单是否支付成功
	 * @param unknown $uid 用户id
	 * @param unknown $type 类型为打赏
	 * @param unknown $objectid 对象ID
	 * @return boolean
	 */
	public function get_isdashang($uid,$type,$objectid){
		$status = $this->m->where(array('uid'=>$uid,'type'=>$type,'objectid'=>$objectid,'status'=>1))->find();
		if($status){
			return true;
		}else{
			return false;
		}
	}
}